ScriptWiz

ScriptWiz is a utility provided to help you produce a basic script file without having to learn the GDIdb script language. Four different basic site structures are supported.

After running ScriptWiz,  you will have a complete and working script file, although you will probably want to add some further HTML to the script to enhance the appearance of the web pages generated when the script is run. (to do this, open the script file with your text editor after ScriptWiz has finished.)


HTML Structures

If you are not certain exactly what structure you require, the best thing to do is to experiment, starting with the structure at the top of the list (which is the easiest to understand) and working down to the last structure on the list (which is the most complex)

The script file produced by script Wizard may be edited later to fine-tune the output, either by just adding HTML tags to control the visual design, or by adding further GDIdb script functions to control the way the HTML is produced. See the GDIdb on-line help for further info on script functions.

Single HTML Page

Multiple HTML pages

Basic Relational Structure

Advanced Relational structure


Script File Name

ScriptWiz uses the information that it will gather from you to generate a GDIdb script file- enter the file name you would like to give this file, which will be placed in the GDIdb program directory. The default name (which you can leave or change) is “script”

After running ScriptWiz you can open the script file from your text editor by selecting Edit/Edit script file from the GDIdb menu.

Note: If a file of the same name already exists, it will be overwritten without warning!


Top-Level HTML document Name

When you run your script, there may be many HTML documents produced by GDIdb whose names will be generated automatically. The top-level page however, (containing either the datasource data or links to further pages) needs to be given a name. The default name (which you can leave or change) is “index.html”


 ODBC DSN or Database file?

GDIdb can extract data from either an ODBC Data Source Name (DSN) or directly from a database/spreadsheet file. Select the option you require.

If you would like more information on ODBC, see the section on ODBC in GDIdb on-line help under “Getting started”


Database Filename/Login Information

Enter (or browse for)  the pathname to your database or spreadsheet file. If access to the database is restricted, you will need to enter a login name and a password- these will be included in the script file created by ScriptWiz.

If a password and/or login name are required but not supplied at this point, a dialog requesting the missing information will open when you attempt to move to the next page of the script wizard. Details entered into this dialog will not be included in the script file- so this dialog will open each time the script itself is run by GDIdb. (which is probably not what you want)

ScriptWiz will attempt to select the correct ODBC driver for your datasource automatically, if this operation is unsuccessful a dialog will open when you attempt to move to the next page of the script wizard requesting that you choose an appropriate driver from the list of drivers installed on your machine. It should be apparent (from the name of the drivers) which one you require.

Notes:

1. dBase and FoxPro Tables, Visual FoxPro free tables- If you are extracting data from dBase or FoxPro tables, or Visual FoxPro free tables, the file path must be to the directory  containing the files, not to the file itself. If you have used to browse button to select a .dbf file, you'll need to remove the filename from the File Path edit box, e.g.

selected file:

C:\Program Files\DevStudio\VFP\SAMPLES\TASTRADE\DATA\Behindsc.dbf

remove the filename, leaving the following path in the edit box:

C:\Program Files\DevStudio\VFP\SAMPLES\TASTRADE\DATA

The following Script Wizard page will allow you to select the file itself.

2. Excel Spreadsheet files- Before you can extract data from an Excel spreadsheet, you need to have a 'named' area of the spreadsheet defined. This named area will be used as your data table by the ODBC driver. Create a named area as follows:

•	Select the area on your spreadsheet that contains the data you wish to publish.

•	Select Name/Define under the Excel Insert menu.

•	Think of a name to give your table, and enter it in the dialog which opens up.

When you move onto the next Script Wizard page, you should see this name in the 'Tables' list box.


ODBC Data Source Name

GDIdb uses Open Data Base Connectivity (ODBC) to extract data from your datasource, either from an ODBC Data Source Name (DSN) or directly from your datasource file.

ScriptWiz will display all of the ODBC DSN’s that have been defined on your system in a list box- select the one that is connected to the datasource whose contents you wish to include in your web site. If you have not created a DSN for your spreadsheet/database, you will need to quit ScriptWiz and run the ODBC  administrator,(located under My Computer/Control Panel) or extract the data directly from your datasource file. (Click on the dialog Back button and choose Database/Spreadsheet file)

See the GDIdb help for further information on setting up ODBC.


Datasource Table

The list box contains all of the tables in your datasource that ScriptWiz could find. Select the one that contains the data that you wish to extract into your web site.

Relational database structures only:

If you selected a basic or advanced relational database structure (Radio buttons 3 & 4 on page 4 of the ScriptWiz dialog) , this will be the data table, and will hold the data which will be grouped into categories stored in the category table that you were asked to select previously.

Note: If you received an error when you moved on to this dialog, it is possible that the ODBC DSN or datasource file that you selected in the previous dialog is not valid.  Check Database Filename/Login Information help topics for more information.


Table Fields

The list box contains all of the fields in the chosen datasource table. Select the fields that contain the data that you wish to extract into your web site, and move them into the listbox on the right hand side by clicking the [>>] button.

Relational database structures only:

If you selected a basic or advanced relational database structure (Radio buttons 3 & 4 on page 4 of the ScriptWiz dialog), the fields that you select here are taken from the data table.

The data records will be grouped into categories stored in the category table that you were asked to select previously.


HTML Formatting

Check the box if you want HTML table formatting tags placed around the data that GDIdb extracts from your datasource. If you’d rather format the output yourself, leave the checkbox blank.

(If you have only selected one datasource field for inclusion in your web site, there is no point in formatting it as a table!)


Finished!

Click finish, and ScriptWiz will write your script.  After running ScriptWiz,  you will have a complete and working script file, although you will probably want to add some further HTML to enhance the appearance of the web pages generated by running the script. Select Edit/Edit Script file from the GDIdb menu (or leave the checkbox at the bottom of the final ScriptWiz dialog ticked)  to open your newly-created script file for editing, the places in the script file where you are most likely to want to add HTML are marked with TODO comments.

If you wish to test-run your script file immediately, select Actions/Open Run Script from the GDIdb menu, and double-click on the script name.

To preview the HTML generated by your script, select Edit/Preview web site from the GDIdb menu, or open the top-level HTML document in the html directory. (which is a sub-directory of the GDIdb program directory)

See the GDIdb on-line help for information on the script language- with an understanding of how GDIdb script language works there are many features that you can add to your web site that are not included in a standard ScriptWiz script.


Link Field Selection

The type of script that you are constructing will build a web site structure where one field from your datasource table is used as a hyperlink to a separate page that includes further fields from the same datasource table.

Select the field in the datasource table whose contents you wish to use as a HTML hypertext link to the second-level HTML pages. (The second-level HTML pages will probably contain the primary data that you are publishing on your web site)


Top-Level Category Table

The type of script that you are constructing (basic or advanced relational database structure) requires two datasource tables. The first table (the category table) is assumed to contain a list of categories, under which entries in the second table (the data table) are grouped. At this point you need to select the category table.

Note: If you received an error when you moved on to this dialog, it is possible that the ODBC DSN or datasource file you selected in the previous dialog is not working correctly.


Contents Hyperlink Field

The type of script that you are constructing (basic or advanced relational database structure) requires two datasource tables. The first table (the category table) is assumed to contain a list of categories, under which entries in the second table (the data table) are grouped.

At this point you need to select the field in the category table whose contents you would like to use as a HTML hyperlink to the pages generated from the data table. (These pages will have records grouped under the link category.)


Relational Key Field

The type of script that you are constructing (basic or advanced relational database structure) requires two datasource tables. The first table (the category table) is assumed to contain a list of categories, under which entries in the second table (the data table) are grouped.

The list box shows all of the fields in the category table, at this point you need to select the field that forms the relational key with the data table. This field must be numeric.


Relational Key Field

The type of script that you are constructing (basic or advanced relational database structure) requires two datasource tables. The first table (the category table) is assumed to contain a list of categories, under which entries in the second table (the data table) are grouped.

The list box shows all of the fields in the data table, at this point you need to select the field that forms the relational key with the category table. This field must be numeric.


Single HTML Page

Select this option to produce the most basic type of script file. Data will be extracted from a single datasource table, and inserted into a single HTML file.

If you just want to include your datasource table as a simple html table in your web site, this is the best structure to choose- the script “foodstore.scp” provided with GDIdb is an example of this type of structure.

Example:

The following database table contains a list of food items. A Single HTML Page script can include this information directly into the web page as a HTML table.

Database Table

ITEM	PRICE	STOCK
Coffee	£2-50	12
Oranges	£0-35	75
Bread	£1-20	56


Multiple HTML Pages

If you select this option, the HTML structure produced will be a top-level HTML document containing links to second level HTML documents, which in turn contain data from the datasource table. Script Wizard will prompt you for the field in the datasource table to be used as an HTML hyperlink to the second-level HTML pages.

If you have a datasource table that contains large text fields, this may be preferable to the above option, as it allows the contents of the large text field to be put on a separate page.

Example:

The following database table contains a list of food items. A Multiple HTML Pages script can produce a top-level links page, using the text from column 1 as the link text. Each of these links will point to a further HTML page that can contain more detailed information about the item (e.g. the data from columns 1,2,3 and 4)

Database Table

ITEM	STOCK	PRICE	DELIVERY
Coffee	12	£2-50	£1.23
Oranges	65	£0-35	£1-23
Bread	675	£1-20	£1-23
Jam	32	£0-55	£1-23


Basic Relational Structure

You need to understand a bit about how relational databases work to use this option, which assumes that you have two database tables, the category table and the data table. The category table contains a list of category names, and the data table contains a list of data items, each one of which belongs to one of the categories in the category table. The two tables each have a field (called the key field) that is used to form the relationship between the two.

The web site created by the script will consist of a top-level links page, with one link for each of the entries in the category  table. These links will point towards further pages that will contain data from the data table, grouped under that link’s category. (Only data table records where the data table key and the category table key match will be included on each of these pages.)

Example:

The following two database tables can be used to generate a top-level links page with 3 links. (The actual link text will be: Vegetables, Poultry and Fish) The page linked to the Vegetables link will contain information on the items Potatoes, Peas and Carrots, the page linked to the Poultry link will contain info on Chicken, Pheasant and Duck, and the page linked to the Fish link will contain info on Salmon. Notice how the key field relates the two tables. (All vegetables have a key value of 1, etc..)

Category Table:

KEY	FOOD TYPE
1	Vegetables
2	Poultry
3	Fish

Data Table:

KEY	FOOD	PRICE
1	Potatoes	£0-45
2	Chicken	£2-34
1	Peas	£0-33
3	Salmon	£8-78
2	Duck	£5-91
2	Pheasant	£7-42
1	Carrots	£0-46


Advanced Relational Structure

You need to understand a bit about how relational databases work to use this option, which assumes that you have two database tables, the category table and the data table. The category table contains a list of category names, and the data table contains a list of data items, each one of which belongs to one of the categories in the category table. The two tables each have a field (called the key field) that is used to form the relationship between the two.

The web site created by the script will consist of:

1. A top-level links page, with one link for each of the entries in the category table.

2. Category links pages, (linked to the top-level page) one for each of the entries in the category table. The category pages will themselves consist of links, the link text is taken from one of the fields in the data table. Only data table records where the data table key and the category table key match will be included on each of these pages as links.

3.Data pages, one for each of the entries in the data table. These pages will be linked from the appropriate category links page, and can contain any or all of the fields from the data table.

Example:

Using the database tables below, the following HTML structure can be produced:

A top-level links page with 3 links. (The actual link text will be: Vegetables, Poultry and Fish) The page linked from the Vegetables link will itself contain more links. (The actual link text will be Potatoes, Peas and Carrots) These links will point to further pages that contain detailed information on the items Potatoes, Peas and Carrots. (E.g. both the FOOD and PRICE fields)

(The same structure will be repeated for Poultry and Fish)

Category Table:

KEY	FOOD TYPE
1	Vegetables
2	Poultry
3	Fish

Data Table:

KEY	FOOD	PRICE
1	Potatoes	£0-45
2	Chicken	£2-34
1	Peas	£0-33
3	Salmon	£8-78
2	Duck	£5-91
2	Pheasant	£7-42
1	Carrots	£0-46

The example script  “workweb.scp” provided with GDIdb is an example of this type of structure.


GDIdb turns the data in your database/spreadsheet into HTML documents by executing a script file. This file is effectively a template describing the web site that will be constructed from your data, and consists of HTML and functions telling GDIdb what database data you wish to include. Run Script Wizard (under Edit) to create a basic script file.